//
//  HeadView.m
//  22-ALiMusic
//
//  Created by dllo on 16/8/16.
//  Copyright © 2016年 ZHW. All rights reserved.
//

#import "HeadView.h"

@interface HeadView ()
@property (nonatomic, strong) UIButton *playButton;
@property (nonatomic, strong) UILabel *randomLabel;
@property (nonatomic, strong) UILabel *songCountLabel;
@property (nonatomic, strong) UIButton *downloadButton;
@property (nonatomic, strong) UIButton *managerButton;
@end
@implementation HeadView

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        [self creatSubViews];
    }
    return self;
}

- (void)creatSubViews {
    self.playButton = [UIButton buttonWithType:UIButtonTypeCustom];
    _playButton.frame = CGRectMake(5, 0, CGRectGetWidth(self.bounds) * 0.1, CGRectGetHeight(self.bounds));
    [_playButton setImage:[UIImage imageNamed:@"play"] forState:UIControlStateNormal];
    [self addSubview:_playButton];
    
    self.randomLabel = [[UILabel alloc] initWithFrame:CGRectMake(_playButton.frame.size.width + 10, 0, CGRectGetWidth(self.bounds) * 0.3, CGRectGetHeight(self.bounds))];
    _randomLabel.text = @"随机播放";
    [self addSubview:_randomLabel];
    
    self.songCountLabel = [[UILabel alloc] initWithFrame:CGRectMake(_randomLabel.frame.size.width + _randomLabel.frame.origin.x, 0, CGRectGetWidth(self.bounds) * 0.15, CGRectGetHeight(self.bounds))];
    _songCountLabel.text = @"";
    [self addSubview:_songCountLabel];
    
    self.downloadButton = [UIButton buttonWithType:UIButtonTypeCustom];
    _downloadButton.frame = CGRectMake(CGRectGetWidth(self.bounds) * 0.6, 0, CGRectGetWidth(self.bounds) * 0.25, CGRectGetHeight(self.bounds));
    [_downloadButton setTitle:@"全部下载" forState:UIControlStateNormal];
    [_downloadButton setTitle:@"全部下载" forState:UIControlStateHighlighted];
    [_downloadButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    [self addSubview:_downloadButton];
    
    self.managerButton = [UIButton buttonWithType:UIButtonTypeCustom];
    _managerButton.frame = CGRectMake(CGRectGetWidth(self.bounds) * 0.85, 0, CGRectGetWidth(self.bounds) * 0.15, CGRectGetHeight(self.bounds));
    [_managerButton setTitle:@"管理" forState:UIControlStateNormal];
    [_managerButton setTitle:@"管理" forState:UIControlStateHighlighted];
    [_managerButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    [self addSubview:_managerButton];
    
}

@end
